<template v-show="this.MineMessage[0].userImg">
  <div>
    <van-nav-bar
      title="个人资料"
      left-text="返回"
      left-arrow
      @click-left="back"
    />
    <Bg>
      <div class="touxiang">
        <span class="touxiangleft">头像</span>
        <img :src="this.MineMessage[0].userImg" alt="" class="touxiangright" />
      </div>
      <div class="UserId">
        <span class="UserIdleft">用户id</span>
        <span class="UserIdright">{{ this.MineMessage[0].userId }}</span>
      </div>
      <div class="Nikename">
        <span class="Nikenameleft">昵称</span>
        <span class="Nikenameright">{{ this.MineMessage[0].nickName }}</span>
      </div>
      <div class="jianjie">
        <span class="jianjieleft">简介</span>
        <span class="jianjieright">{{this.MineMessage[0].desc ? this.MineMessage[0].desc : '这家伙很懒，什么都没留下。'}}</span>
      </div>
    </Bg>
  </div>
</template>

<script>
import Bg from "../components/Bg.vue";
import "../assets/less/Mine.less";
export default {
  name: "Mine",
  components: {
    Bg,
  },
  data() {
    return {
      MineMessage: "",
    };
  },
  created() {
    this.getAddressListData();
  },
  methods: {
    back() {
      this.$router.go(-1);
    },
    getAddressListData() {
      let tokenString = this.$cookies.get("tokenString");

      if (!tokenString) {
        console.log("浏览器token不存在");
        return this.$router.push({ name: "Login" });
      }

      this.$toast.loading({
        message: "加载中...",
        forbidClick: true,
        duration: 0,
      });

      this.axios({
        //请求方式
        method: "GET",
        url: this.baseUrl + "/findAccountInfo",
        params: {
          appkey: this.appkey,
          tokenString,
        },
      })
        .then((res) => {
          console.log("res getAddressListData ==> ", res);
          this.$toast.clear();

          if (res.data.code === "B001") {
            this.MineMessage = res.data.result;
          } else {
            this.$toast({
              message: res.data.msg,
              forbidClick: true,
              duration: 3000,
            });
          }
        })
        .catch((err) => {
          this.$toast.clear();
          console.log("err ==> ", err);
        });
    },
  },
};
</script>

<style>
</style>